package com.cskaoyan.controller;

import com.cskaoyan.bean.MallGoods;
import com.cskaoyan.bean.MallGoodsExample;
import com.cskaoyan.mapper.MallGoodsMapper;
import com.cskaoyan.model.vo.BaseRespVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @program: project-market
 * @description: 测试Handler
 * @author: fish-team
 * @create: 2021-11-29 15:50
 **/
@RestController
public class TestController {

    @Autowired
    MallGoodsMapper goodsMapper;


    @RequestMapping("hello")
    public BaseRespVo hello() {

        MallGoodsExample goodsExample = new MallGoodsExample();
        goodsExample.createCriteria().andDeletedEqualTo(false).andCategoryIdEqualTo(1008009);
        goodsExample.setOrderByClause("sort_order" + " " + "desc");
        List<MallGoods> goodsList = goodsMapper.selectByExample(goodsExample);
        int size = goodsMapper.selectByExample(goodsExample).size();

        return BaseRespVo.ok(goodsList);

    }

}
